<template>
    <div>
      <div style="text-align: center" v-if="list.length === 0">
        <img src="static/image/nl.png" alt="" style="height: 180px">
      </div>
      <Table size="small" v-if="list.length > 0" :data="list" :columns="columns"></Table>
    </div>
</template>
<script>
  export default {
    data() {
      return {
        list: [],
        columns: [
          {
            title: '需求编号',
            key: 'requirecode',
            width: 200,
            render:(h,params) =>{
              return h('div',params.row.requirecode || '暂无')
            }
          },
          {
            title: '类型',
            key: 'type',
            sortable: true
          },
          {
            title: '阶段',
            key: 'stagename',
            sortable: true,
            width:200
          },
          {
            title: '分派人',
            key: 'assignername',
            sortable: true
          },
          {
            title: '指派时间',
            key: 'starttimeStr',
            sortable: true,
            width: 200
          },
          {
            title: '操作',
            key: 'action',
            render: (h, params) => {
              return h('a', {
                attrs: {
                  href: 'javascript:void(0)'
                },
                style: {
                  color: '#1890ff'
                },
                on: {
                  click: () => {
                    this.dispatchList(params.row)
                  }
                }
              }, '处理')
            }
          }
        ],
      }
    },
    methods: {
      getList(page) {
        let obj = {
          pageNum: page,
          pageSize: 3
        };
        $.ajax('../api/workflow/selectWaitWork', {
          method: "post",
          contentType: "application/json;charset=utf-8",
          data: JSON.stringify(obj),
          success: (data) => {
            if (data.code === 200) {
              this.list = data.data.list;
            } else {
              this.$Notice.warning({
                title: data.data
              });
            }
          }
        })
      },
    },
    mounted() {
      this.getList(1)
    }
  }
</script>
